package com.carkeeper.controller;

import com.carkeeper.dto.OrderDTO;
import com.carkeeper.dto.ServiceDTO;
import com.carkeeper.service.OrderFeign;
import com.carkeeper.service.ServiceFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: dongxing
 * @date ：Created in 2020/6/1
 * @description ：
 * @version: 1.0
 */
@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private ServiceFeign serviceFeign;
    @Autowired
    private OrderFeign orderFeign;

    @PostMapping
    public List<ServiceDTO> getByIds(@RequestBody List<Long> ids){
        return serviceFeign.getListById(ids);
    }
    @GetMapping("/{id}")
    public ServiceDTO getById(@PathVariable Long id){
        return serviceFeign.getById(id);
    }
    @GetMapping("/my/{id}")
    public void test(@PathVariable("id") Long id){
        OrderDTO order = orderFeign.getOrder(id);
        System.out.println(order);
    }
}
